﻿--|--------------------------------------------------------------------------------
--| [UpdateEntity] - Update Procedure Script for Entity
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[UpdateEntity]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
	DROP PROCEDURE [dbo].[UpdateEntity]
GO

CREATE PROCEDURE [dbo].[UpdateEntity]
(
	@ID int,
	@Name nvarchar(50),
	@Description nvarchar(250) = NULL,
	@TeamID int,
	@Photo image = NULL,
	@EntityTypeID int
)
AS
	SET NOCOUNT ON
	
	UPDATE [Entity]
	SET
		[Name] = @Name,
		[Description] = @Description,
		[TeamID] = @TeamID,
		[Photo] = @Photo,
		[EntityTypeID] = @EntityTypeID
	WHERE 
		[ID] = @ID

	RETURN @@Error
GO
 